export const watch = {
    data() {
        var checkPostalCode = (rule, value, callback) => {
            if (!this.form.postalCode || !this.form.postalNo) {
                return callback(new Error(this.$t('formRule.inputPlaceholder')));
            } else {
                callback()
            }
        };
        var checkPhone = (rule, value, callback) => {
            if (!this.form.phoneCode || !this.form.phoneNo) {
                return callback(new Error(this.$t('formRule.inputPlaceholder')));
            } else {
                callback()
            }
        };
        return {
            mode: "add",
            showProp: false,
            disabled: false,
            accountForm: {},
            form: {
                "id": null,
                "card": "",
                "compatibleDevices": [],
                "createdAt": "",
                "imageUrl": "",
                "name": "",
                "price": 9.9,
                "resolution": "",
                "status": false,
                "trialDuration": 6,
                "updatedAt": ""
            },
            aRules: {
                "oldPassword": [
                    { required: true, message: this.$t('formRule.inputPlaceholder'), trigger: 'change' }
                ],
                "newPassword": [
                    { required: true, message: this.$t('formRule.inputPlaceholder'), trigger: 'change' }
                ],
            },
            rules: {
                "accountEmail": [
                    { required: true, message: this.$t('formRule.inputPlaceholder'), trigger: 'change' }
                ],
                "password": [
                    { required: true, message: this.$t('formRule.inputPlaceholder'), trigger: 'change' }
                ],
                "name": [
                    { required: true, message: this.$t('formRule.inputPlaceholder'), trigger: 'change' }
                ],
                "officialAddress": [
                    { required: true, message: this.$t('formRule.inputPlaceholder'), trigger: 'change' }
                ],
                // "zipCode": [
                //   {required: true,message: this.$t('formRule.inputPlaceholder'),trigger: 'change'}
                // ],
                // "phone": [
                //   {required: true, message: this.$t('formRule.inputPlaceholder'),trigger:'change'}
                // ],
                "postalCode": [
                    { required: true, validator: checkPostalCode, trigger: 'change' }
                ],
                "phoneCode": [
                    { required: true, validator: checkPhone, trigger: 'change' }
                ],
            },
            visible: false,
            isSaveing: false
        }
    },
    created() {

    }
}
